import React, {Component} from 'react';
import { Icon, Button, Table, Input } from 'antd';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import BreadcrumbBar from '@/common/BreadcrumbBar';//面包屑组件
import ToolBar from '@/common/ToolBar';//操作栏组件

const Search = Input.Search;

/** 交由redux管理的所有变量 */
const mapStoreStateToProps = state => ({
    data: state.person
});
  
// const mapDispatchToProps = dispatch => ({
    
    
// });

class CompleteTask extends Component {
    constructor(props) {
        super(props);
        this.state = {
            dataSource: []
        }

        this.columns = [
            { title: '建议日期', dataIndex: 'date', },
			{ title: '建议标题', dataIndex: 'title', width: 200,},
            { title: '建议分类', dataIndex: 'category', },
            { title: '建议人', dataIndex: 'name',},
            { title: '联系电话', dataIndex: 'tel',},
            { title: '部门', dataIndex: 'dept',},
            { title: '办理人', dataIndex: 'dojob',},
            { title: '提交时间', dataIndex: 'commitdate', },
            { title: '状态', dataIndex: 'status',},
			{ title: '操作', dataIndex: 'operator',
				render: (text, record, index) => {
					return (
						<div>
							<Button>查看</Button>&nbsp;
                            {/* <Button>编辑</Button>&nbsp;
							<Button type="danger">删除</Button> */}
						</div>
					)
				}
			},
        ]
    }
    componentWillMount(){
    //    console.log("个人 props",this.props)
    }
    componentDidMount() {

    }

    render() {
        return (
		   <div>
                <BreadcrumbBar one="个人事务" two="已办任务"/>
                <ToolBar>
                    <Search placeholder="请输入姓名" 
						onSearch={value => console.log(value)}
						style={{ width: 200, float: 'right' }}
					/>
                </ToolBar>
                <Table 
					dataSource={this.props.data} 
					rowKey={record => record.id}
					columns={this.columns} 
					loading={false}
					pagination={{
						showTotal:(total, range) => `共 ${total} 条  显示  ${range[0]}-${range[1]} 条`
					}}
					bordered={true} 
				/>
		   </div>
        )
    }
}

CompleteTask.PropTypes = {
    data: PropTypes.array.isRequired
}

export default connect(mapStoreStateToProps)(CompleteTask);
